Welcome to django!

1、新建一个python文件views

from django.shortcuts import render

def index(request):

return render(request, template_name= "index.html")


2、在urls增加路由

from django.contrib import admin

from django.urls import path

from . import views

urlpatterns = [

path( 'admin/' , admin.site.urls),

path("",views.index)

]

3、在TEMPLATES

TEMPLATES = [

{

BACKEND': 'django.template.backends.django.DjangoTemplates' ,

# 'DIRS': [os.path.join(BASE_DIR,"templates")], #增加文件路径

}, ]


1、 html里面输入

< !DOCTYPE html >

< html lang="en" >

< head >

< meta charset="UTF-8" >

< title > Title < /title >

< /head >

< body >

< h1 > 欢迎来到盛凌报价系统 < /h1 >

< p > 只有你想不到的,没有做不到的 < /p >

< button > < a href="" > 开始吧 < /a > < /button >

< /body >

< /html >